home *** CD-ROM | disk | FTP | other *** search
- /*
- cvfeatur.cpp
-
- List of features window
-
- C++/Views 2.0 Demo
- Copyright (c) 1992, by Liant Software Corp.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- */
-
- #include "cvfeatur.h"
- #include "cvdemovw.h"
- #include "editbox.h"
- #include "listbox.h"
- #include "messengr.h"
- #include "brush.h"
- #include "font.h"
- #include "tagstrm.h"
-
- defineClass(FeatureView, VMdiView)
-
- FeatureView::FeatureView()
- {
- ;
- }
-
- FeatureView::FeatureView(VFrame &f, DemoAppView *parent)
- : VMdiView("FeatureIcon", f, (VWindow *) parent, StyleBorder | StyleTitle | StyleCloseBox | StyleSizable)
- {
- mainWin = parent;
-
- setTitle("C++/Views Features");
-
- listFont = new VFont("Arial", 10);
- listFont->bold(TRUE);
- msgFont = new VFont("Arial", 10);
-
- /* create a list box */
- listBox = new VListBox(VFrame(0.05F, 0.05F, 0.9F, 0.4F), this, StyleBorder);
- listBox->uponClick(this, methodOf(FeatureView, singleClick),
- methodOf(FeatureView, doubleClick));
-
- listBox->setFont(listFont);
-
- /* read in list of features from the message file */
- VTagStream tagStrm;
- VString cmd;
- VStream flist(cvTextFile->getMessage("Features:List"));
-
- tagStrm.beginScan(&flist, NIL);
- tagStrm.tags('(', ')');
-
- while(tagStrm.getTag(cmd)) {
- listBox->appendString(cmd.gets());
- }
-
- /* create an edit box */
- msgBox = new VEditBox(VFrame(0.05F, 0.5F, 0.9F, 0.35F), this,
- StyleBorder | StyleVertical | StyleWordWrap | StyleReadOnly);
-
-
- msgBox->setFont(msgFont);
-
- msgBox->putText(cvTextFile->getMessage("Features:Intro").gets());
-
- /* make sure the "About this Window" data is set up */
- mainWin->setAboutNames("Feature:About", "cvfeatur.cpp");
- }
-
- FeatureView::~FeatureView()
- {
- /* destroy background brush (if present) */
- delete getBackground();
-
- delete listFont;
- delete msgFont;
- }
-
- boolean FeatureView::free()
- {
- delete this;
- return(TRUE);
- }
-
- boolean FeatureView::close()
- /*
- The user has closed the window.
- Notify the main window so that it can update the main menu bar
- */
- {
- mainWin->featureView = 0;
- mainWin->updateMenu();
- return(FALSE);
- }
-
- boolean FeatureView::singleClick(int index)
- /*
- Mouse clicked on the list box
- */
- {
- VString idx("Features:");
- VString *temp;
-
- temp = listBox->selectedString();
- idx.concat(temp);
- delete temp;
-
- msgBox->putText(cvTextFile->getMessage(idx.gets()).gets());
- return(TRUE);
- }
-
- boolean FeatureView::doubleClick(int index)
- /*
- Mouse double-clicked on the list box
- */
- {
- return(TRUE);
- }
-
- boolean FeatureView::givenFocus()
- /*
- Our window has just been given input focus
- */
- {
- /* set the data for the About this Window dialog */
- mainWin->setAboutNames("Feature:About", "cvfeatur.cpp");
-
- /* carry on with default window behavior, return FALSE */
- return(FALSE);
- }
-
-